﻿Public Class MessageCommon
    'エラーメッセージボックス表示
    Public Shared Sub showError(ByVal msg As String)
        MessageBox.Show(msg, "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error)
    End Sub
    '通知メッセージボックス表示
    Public Shared Sub showInformation(ByVal msg As String)
        MessageBox.Show(msg, "通知", MessageBoxButtons.OK, MessageBoxIcon.Information)
    End Sub
    '確認メッセージボックス表示
    Public Shared Function showConfirm(ByVal msg As String) As System.Windows.Forms.DialogResult
        Return MessageBox.Show(msg, "確認", MessageBoxButtons.OKCancel, MessageBoxIcon.Question)
    End Function
    'メッセージ作成関数（１引数）
    Public Shared Function getMessage(ByVal param As Object, ByVal patern As String) As String
        Try
            Return patern.Replace("「0」", param.ToString)
        Catch ex As Exception
            Return patern
        End Try
    End Function
    'メッセージ作成関数（２引数）
    Public Shared Function getMessage(ByVal param1 As Object, ByVal param2 As Object, ByVal patern As String) As String
        Try
            Dim message = patern.Replace("「0」", param1.ToString)
            Return message.Replace("「1」", param2.ToString)
        Catch ex As Exception
            Return patern
        End Try
    End Function
End Class
